﻿@model BrnMall.Web.StoreAdmin.Models.CashRecordListModel

@section header{
    <title>余额交易记录-店铺管理</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <script type="text/javascript" src="/components/my97datepicker/WdatePicker.js"></script>
}
@section body{
    <h1 class="rightH1">
		微信小程序 &gt; 店铺管理 &gt; <span class="rightH1-cur">余额交易记录</span> 
        <div class="right">
        </div>
        <div class="clear"></div>
    </h1>
    @using (Html.BeginForm("cashrecordlist", "cash"))
    {
        <div class="dataListSearch">
            <table height="32">
                <tbody>
                    <tr>
                        <td width="35"><img id="searchImg" src="/admin_store/images/search1.gif" /></td>                    
                        <td>&nbsp;&nbsp;&nbsp;会员昵称：</td>
                        <td width="130">@Html.TextBox("AccountName", Model.AccountName, new { height = "18" })</td>
                        <td>&nbsp;&nbsp;&nbsp;类型：</td>
                        <td width="80">
                            <select id="direction" name="direction" style="width:80px">
                                <option value="0">全部</option>
                                <option value="1">收入</option>
                                <option value="2">支出</option>
                            </select>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;时间段：</td>
                        <td width="180">@Html.TextBox("StartTime",Model.StartTime, new { style= "width:70px;height:18px;",  onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})" })至 @Html.TextBox("EndTime", Model.EndTime, new { style = "width:70px;height:18px;" ,onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})" })</td>
                        <td>
                            <input id="SearchOrder" name="SearchOrder" type="image" class="searchBut submit" src="/admin_store/images/s.jpg" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="table_top"></div>

        <div class="dataList">
            <table width="100%">
                <thead>
                    <tr>
                        <th width="200" style="text-align:center">会员昵称</th>
                        <th align="left">描述</th>
                        <th align="left">交易金额</th>
                        <th align="left">余额</th>
                        <th align="left">类型</th>
                        <th align="left">交易时间</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var info in Model.List)
                    {
                        <tr>
                            <td style="text-align:center">@info.AccountName</td>
                            <td>@info.remark</td>
                            @if (@info.Direction == 1)
                            {
                                <td>+@info.Amount</td>
                                <td align="left">@info.Balance</td>
                                <td>收入</td>
                            }
                            else
                            {
                            <td>-@info.Amount</td>
                            <td align="left">@info.Balance</td>
                            <td>支出</td>
                            }
                            <td> @info.CreateTime.ToString("yyyy-MM-dd hh:mm:ss") </td>
                        </tr>
                    }
                    @if (Model.List.Count == 0)
                    {
                        <tr><td colspan="6" style="text-align:center;">没有记录</td></tr>
                    }
</tbody>
            </table>
        </div>
        <input type="hidden" id="uid" name="uid" value="@Model.uid" />

        <div style=" height:80px; margin-left:100px; margin-top:10px; font-size:14px;display:none;">
            <div style="font-weight:bold;">时间段统计：</div>
            <div>时间段：<span class="time"></span></div>
            <table>
                <tr>
                    <td>总支出：@Model.TimeOutMoney 元</td>
                    <td style="width:100px;"></td>            
                    <td>总收入：</td>
                    <td style="width:100px;">@Model.TimeInMoney 元</td>
                </tr>
            </table>
        </div>


        <div class="dataListEdit">
            <div class="page">
                @Html.StoreAdminPager(Model.PageModel)
            </div>
        </div>
        <script>
        $(function () {
            load();
        })

        function load() {
            //日期
            var starttime = $("#StartTime").val();
            var endtime = $("#EndTime").val();
            $(".time").html(starttime + " 至 " + endtime);

            //下拉框
            var direction = '@Model.Direction';
            var sel = document.getElementById("direction");
            for (var i = 0; i < sel.options.length; i++) {
                if (sel.options[i].value == direction)
                    sel.selectedIndex = i;
            }
        }
        </script>
    }
}